<?php
$login = $_POST['login'];
$entrar = $_POST['entrar'];
$senha = md5($_POST['senha']);


$connect = mysql_connect('mysql.hostinger.com.br','u770602373_admin','retsam$123');
$db = mysql_select_db('u770602373_sgc');

if(isset($entrar)){
	$verifica = mysql_query("SELECT * FROM usuario WHERE login = '$login' AND senha = '$senha'") or die ("erro ao fazer o select");
	if(mysql_num_rows($verifica)<=0){


		echo"<script language='javascript' type='text/javascript'>
		alert('Login e/ou senha incorretos');
		window.location.href='login.html';</script>";

		die();
	}else{
		setcookie("login",$login);
		header("Location:index.php");
	}
}

?>